package com.isaac.demo.controller;

import com.isaac.demo.service.IDemoService;
import com.isaac.edu.mvcframework.annotation.DiyAutoWired;
import com.isaac.edu.mvcframework.annotation.DiyController;
import com.isaac.edu.mvcframework.annotation.DiyRequestMapping;
import com.isaac.edu.mvcframework.annotation.DiySecurity;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@DiyController
@DiyRequestMapping("/demo")
public class DemoController {

    @DiyAutoWired
    private IDemoService demoService;

    /**
     * url : /demo/query
     * @param request
     * @param response
     * @param name
     * @return
     */
    @DiyRequestMapping("/query")
//    @DiySecurity({"fff"})
    public String query(HttpServletRequest request, HttpServletResponse response, String name){
        return demoService.get(name);
    }

    @DiyRequestMapping("/securityLi")
    @DiySecurity({"Li"})
    public String security1(HttpServletRequest request, HttpServletResponse response, String name){
        return demoService.get(name);
    }

    @DiyRequestMapping("/securityWang")
    @DiySecurity({"Wang"})
    public String security2(HttpServletRequest request, HttpServletResponse response, String name){
        return demoService.get(name);
    }

    @DiyRequestMapping("/securityLi&Wang")
    @DiySecurity({"Li","Wang"})
    public String security3(HttpServletRequest request, HttpServletResponse response, String name){
        return demoService.get(name);
    }


}
